import { defineStore } from 'pinia'
import { onMounted, reactive, ref } from 'vue'
import { get, post } from '@/utils/api'
import { MessagePlugin } from 'tdesign-vue-next'

export const useAdminMyselfStore = defineStore('adminMyself', () => {
  const data = reactive({
    id: 2001110500,
    email: '',
    password: '',
    name: '',
    status: 1
  })

  const getConfig = async () => {
    const response = await get('/api/user/getInfo')
    console.log(response)
    Object.assign(data, response)
  }

  const saveConfig = async () => {}
  const loading = ref<boolean>(false)
  onMounted(async () => {
    await getConfig()
  })

  return {
    data,
    saveConfig,
    loading
  }
})
